package com.neutech.controller;

import com.google.gson.Gson;
import com.neutech.entity.Business;
import com.neutech.service.BusinessService;
import com.neutech.service.impl.BusinessServiceImpl;
import com.neutech.vo.ResultVO;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet(urlPatterns = "/business/list")

public class BusinessListServlet extends HttpServlet {

    private BusinessService businessService = new BusinessServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //判断是否登录
        PrintWriter out = resp.getWriter();
        out.println(new Gson().toJson(businessService.listBusiness()));
        out.close();
    }
}
